package web

import (
	"github.com/gin-gonic/gin"
)

type Result struct {
	Code  int    `json:"code"`
	Msg   string `json:"msg"`
	Data  any    `json:"data"`
	Count int64  `json:"count"`
}

func RenderJSON(ctx *gin.Context, status, code int, msg string, data any) {
	ctx.JSON(status, Result{
		Code: code,
		Msg:  msg,
		Data: data,
	})
}
func RenderJSONPage(ctx *gin.Context, status, code int, msg string, data any, count int64) {
	ctx.JSON(status, Result{
		Code:  code,
		Msg:   msg,
		Data:  data,
		Count: count,
	})
}
